import {
  Component,
  ChangeDetectionStrategy,
  OnInit, Renderer2, Inject,
} from '@angular/core';

import { ApesMessageService } from '@shared/apes/message';
import { DOCUMENT } from '@angular/common';

@Component({
  selector: 'app-account-settings-theme',
  templateUrl: './theme.component.html',
  styleUrls: ['./theme.component.scss'],
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ProAccountSettingsThemeComponent implements OnInit {



  constructor(
    @Inject(DOCUMENT) private doc: any,
    private render: Renderer2,
    private msg: ApesMessageService,
  ) {
  }

  ngOnInit() {
  }

  setClass(themeName){
    const body = this.doc.querySelector('body');
    let bodyClass = body.classList;
    let className = '';
    bodyClass.forEach((name)=>{
      if(name !== 'has-ad-rt'){
        className = name;
      }
    });
    if(className != themeName){
      this.render.removeClass(body,className);
      this.render.addClass(body,themeName);
    }
  }

}
